package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
	"reflect"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database reflect.StructTag
}
type AppConfig struct {
	Mysql
}

var Config AppConfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	viper.ReadInConfig()
	err := viper.Unmarshal(&Config)
	if err != nil {
		panic(err)
	}
	fmt.Println("配置文件成功")
}
